import React, { Component } from 'react';
import {Popup} from 'antd-mobile'
import style from './guideMask.scss'

class GuideMask extends Component {
    constructor(props) {
        super(props);
        this.state = {
        };
    }

		componentWillMount(){

    }

		componentDidMount() {
		
		}

		componentWillUnmount() {
		
		}

    render() {
	    let cacheAddress;
	    if(!this.props.isShowChice){
		    cacheAddress = JSON.parse(sessionStorage.getItem('choiceAddress'))
	    }else {
		    cacheAddress = this.props.twDefaultAddress&&this.props.isShowChice? this.props.twDefaultAddress:
			    JSON.parse(sessionStorage.getItem('choiceAddress'))?JSON.parse(sessionStorage.getItem('choiceAddress')):'';  //进入地址列表缓存的地址信息  选择地址的缓存

		    sessionStorage.setItem('choiceAddress',JSON.stringify(cacheAddress))
	    }
	    return (
            <div className={style.mask} style={this.props.isShowMask?{}:{display: 'none'}} onClick={()=>{this.props.onClick()}} ref="prevent" onTouchMove={(e)=>{e.preventDefault(); e.stopPropagation();}}>
							<div className={style.prompt}>
								<div className={style.title}>
									您当前所选择的收件地方（{`${cacheAddress.fullAddr + cacheAddress.street}`}）暂未开通上门收件服务，我们建议您更换收件人地址，或是到以下附近的邮政网点办理：
								</div>

								{
									this.props.emsSitesList.map((e,i)=>
										<p className={style.address} key={i}>
											{
												`${i+1}、${e.name} 地址:${e.address}`
											}
										</p>
									)
								}
								<div className={style.btn}>
									确定
								</div>
							</div>
            </div>
        )
    }
}

GuideMask.defaultProps = {

}

export default GuideMask